/*
 * GDataValidationException.java
 * Created on 30 déc. 2007
 *
 * Glacéo Internet Platform
 * http://sourceforge.net/projects/chm/
 *
 * Copyright (c) 2005-2008, Jens and Jan Janke (VirtualHockey Project)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hockeo.vhbase.error;

/**
 * This exception is thrown if there is a data validation problem (e.g. a parameter passed
 * in an HTML request is not correct).
 *
 * @version $Id$
 * @author jjanke
 */
public class GDataValidationException extends GException
{
  /**
   * Creates a new GDataException.
   *
   * @param strMsg the error message
   * @param cause the exception that caused this exception to be created
   */
  public GDataValidationException( String strMsg, Throwable cause )
  {
    super( strMsg, cause );
  }

  /**
   * Creates a new GDataException.
   *
   * @param cause the exception that caused this exception to be created
   */
  public GDataValidationException( Throwable cause )
  {
    super( cause );
  }

  /**
   * Creates a new exception based on the given information concerning the name of
   * the validated param, the wrong value and an optional explanatory text.
   *
   * @param strParameter the name of the validated parameter
   * @param strWrongValue the value for which the validation failed
   * @param strText an optional explanatory text (may be <code>null</code>)
   */
  public GDataValidationException( String strParameter, String strWrongValue, String strText )
  {
    super( "Validation for Parameter '" + strParameter + "' failed. The supplied value '" + strWrongValue +
           "' is wrong.\n" + ( strText != null ? strText : "" ) );
  }

  /**
   * Creates a new exception based on the given information concerning the name of
   * the validated param, the wrong value and an optional explanatory text.
   *
   * @param strParameter the name of the validated parameter
   * @param strWrongValue the value for which the validation failed
   * @param strText an optional explanatory text (may be <code>null</code>)
   * @param cause the exception that caused this exception to be created
   */
  public GDataValidationException( String strParameter, String strWrongValue, String strText, Throwable cause )
  {
    super( "Validation for Parameter '" + strParameter + "' failed. The supplied value '" + strWrongValue +
           "' is wrong.\n" + ( strText != null ? strText : "" ), cause );
  }

  /**
   * Creates a new GDataException.
   *
   * @param strMsg the error message
   */
  public GDataValidationException( String strMsg )
  {
    super( strMsg );
  }
}
